import { createRouter, createWebHistory } from "vue-router";
import Home from "@/views/Home";

const routes = [
  { path: '/', redirect: '/home' },
  { path: "/home",  name: "Home", meta: { requiresAuth: true }, component: Home, },
  { path: "/login", name: "login", meta: { requiresAuth: true }, component: () => import(/* webpackChunkName: "login" */ "@/views/Login"), },
  { path: "/register", name: "register", meta: { requiresAuth: true }, component: () => import(/* webpackChunkName: "register" */ "@/views/Register"), },
  { path: "/search/:keyword?", name: "search", meta: { requiresAuth: true }, component: () => import(/* webpackChunkName: "search" */ "@/views/Search"), },
];
const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
